﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    public class MySprite
    {
        public MySprite()
        {
        }
        public MySprite(Texture2D[] inputTexture2Ds, Rectangle size, Vector2 Origin)
        {
            _texture2ds = inputTexture2Ds;
            this.Position = Vector2.Zero;
            this.itexture2d = 0;
            this.ntexture2d = inputTexture2Ds.Length;
            this.RotationAngle = 0.0f;
            this.Size = size;
            this.Origin = Origin;
        }

        private Texture2D[] _texture2ds;
        public Texture2D[] Texture2ds
        {
            get { return _texture2ds; }
            set
            {
                _texture2ds = value;
                _ntexture2d = _texture2ds.Length;
            }
        }


        private int _ntexture2d;
        public int ntexture2d
        {
            get { return _ntexture2d; }
            set { _ntexture2d = value; }
        }

        private int _itexture2d;
        public int itexture2d
        {
            get { return _itexture2d; }
            set { _itexture2d = value; }
        }

        protected Vector2 _position;
        public Vector2 Position
        {
            get { return _position; }
            set { _position = value; }
        }

        protected float _rotationAngle;   // goc ve anh
        public float RotationAngle
        {
            get { return _rotationAngle; }
            set { _rotationAngle = value; }
        }

        protected Rectangle _collisionRect;
        public Rectangle CollisionRect
        {
            get { return _collisionRect; }
            set { _collisionRect = value; }
        }
        
        protected Rectangle _size;
        public Rectangle Size
        {
            get { return _size; }
            set
            {
                _size = value;
              //  _origin = new Vector2(_size.Width / 2, _size.Height / 2);
            }
        }
        
        protected Vector2 _origin;
        public Vector2 Origin
        {
            get { return _origin; }
            set { _origin = value; }
        }

       
        public void Update(GameTime gameTime)
        {            
        }

        public virtual void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Texture2ds[itexture2d], _position, _size, Color.White,
                _rotationAngle, _origin, 1.0f, SpriteEffects.None, 0.0f);
        }
    }
}
